home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / www / library / implemen / vms / getpass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  1.6 KB  |  61 lines

  1. /* Copyright (C) 1991 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /* CHANGED FOR VMS */
  20.  
  21. /*
  22.  * <getpass.c>
  23.  */
  24.  
  25. #include <stdio.h>
  26. #include <descrip.h>
  27. #include <psldef.h>
  28. #include <iodef.h>
  29.  
  30. char *getpass (const char *prompt)
  31. {
  32.   static char *buf;
  33.  
  34.   int result;
  35.   $DESCRIPTOR(devnam,"SYS$INPUT");
  36.   int chan;
  37.   int promptlen;
  38.   struct {
  39.      short result;
  40.      short count;
  41.      int   info;
  42.   } iosb;
  43.  
  44.   promptlen = strlen(prompt);
  45.  
  46.   buf = malloc(256);
  47.   if (buf == NULL)
  48.      return(NULL);  
  49.  
  50.   result = SYS$ASSIGN(&devnam, &chan, PSL$C_USER, 0, 0);
  51.  
  52.   result = SYS$QIOW(0, chan, IO$_READPROMPT | IO$M_PURGE |IO$M_NOECHO, &iosb, 0, 0,
  53.                     buf, 255, 0, 0, prompt, promptlen);
  54.  
  55.   buf[iosb.count] = '\0';
  56.  
  57.   result = SYS$DASSGN(chan);
  58.  
  59.   return buf;
  60. }
  61.